let img = new Image(); 
img.onload = img.onerror = function() { 
 alert("Done!"); 
}; 
img.src = "http://www.example.com/test?name=Nicholas";